﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace FindAllCustomers
{
    class FindAllTask
    {
        static void Main(string[] args)
        {
            NorthwindEntities entities = new NorthwindEntities();
            using (entities)
            {
                DateTime firstDate = new DateTime(1997,1,1);
                DateTime lastDate = new DateTime(1998, 1, 1);

                var customers =
                    from c in entities.Customers
                    join o in entities.Orders on c.CustomerID equals o.CustomerID
                    where o.OrderDate >= firstDate && o.OrderDate < lastDate && o.ShipCountry == "Canada"
                    select new { CompanyName = c.CompanyName, OrderDate = o.OrderDate};

                foreach (var item in customers)
                {
                    Console.WriteLine(item.CompanyName+" "+item.OrderDate);
                }
                    
            }
        }
    }
}
